package cn.johnyu.consumer.controller;

import cn.johnyu.commons.model.Product;
import cn.johnyu.consumer.client.ProviderClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class ConsumerController {
    @Autowired
    private RestTemplate restTemplate;
    @Autowired
    private ProviderClient providerClient;
    @GetMapping("/consum")
    public Product consum(){
        return providerClient.findProduct();
//        return restTemplate.getForObject("http://provider-service/product",Product.class);
    }
}
